<?php
require './include/global.php';
require './include/validate.php';
require './include/all_left.php';
require_once './include/advisory_db.php';

$userType = $_SESSION['usertype'];
//if('candidate' == $userType)
///{
//	$and_sql = " WHERE jo_contact='1'";
//}
//else
//{
	$and_sql = " WHERE FIND_IN_SET('1', jo_contact)";
//}

$nav = new buildNav;
$nav->limit=25;

$total = $DB->fetch_one_array("SELECT COUNT(*) AS count FROM pa_job".$and_sql);
$nav->total_result = $total[count];
$nav->execute("SELECT * FROM pa_job ".$and_sql." ORDER BY jo_id DESC");

$page = $nav->pagenav();
$smarty->assign("page",$page);

$i=0;
while($list2 = $DB->fetch_array($nav->sql_result)){
   $data[$i]              = $list2;
   $data[$i][location]    =  $list2[jo_city].", ".$state[$list2[jo_state]] ;

   $i++;
}
$smarty->assign("joblist",$data);


$sql      = "SELECT * FROM pa_candidates ORDER BY js_id DESC LIMIT 0,9";
$result   = $DB->query($sql);
$i=0;
while($list = $DB->fetch_array($result)){
   $data_list[$i][a0] = $list[js_uname];
   $data_list[$i][a1] = $jobcategory[$list[js_industry]];
   $data_list[$i][a2] = $list[js_title];
   $data_list[$i][a5] = $list[js_id];
  $i++;
}
$smarty->assign("canlist",$data_list);

/*
$url = "http://www.shrm.org/shrmnewsfeeds/createmyfeedjs.asp?category=m&nchannel=m&width=100&maxarticles=5&xchannel=Headlines&TitleFontSize=1";
$rss1 = @file_get_contents($url);
//$a1 = array('|<br><br>|U','|height=("?)[0-9]+("?)|U','|(<p >)(.*)(</p>)|U','|(<\/?)(TABLE|table\w+)([^>]*>)|U');
//$a2 = array('','1','','');
$a1  = array('/(<\/?)(TABLE|table|tbody|TBODY|td|tr|TD|TR|TR|font|B|b|br|BR\w+)([^>]*>)/i','/(<p)(.*)(p>)/i','/(<a)(.*)(\/a>)/i');
$a2  = array('','','<li>\1\2\3</li>');
$rssp1 = preg_replace($a1,$a2,$rss1);
$smarty->assign('rss1',$rssp1);

$url2 = "http://www.shrm.org/shrmnewsfeeds/createmyfeedjs.asp?category=global&nchannel=global&width=100&maxarticles=5&xchannel=headlines&TitleFontSize=1";
$rss2 = @file_get_contents($url2);
$a1  = array('/(<\/?)(TABLE|table|tbody|TBODY|td|tr|TD|TR|TR|font|B|b|br|BR\w+)([^>]*>)/i','/(<p)(.*)(p>)/i','/(<a)(.*)(\/a>)/i');
$a2  = array('','','<li>\1\2\3</li>');
$rssp2 = preg_replace($a1,$a2,$rss2);
$smarty->assign('rss2',$rssp2);
*/
$smarty->assign('rss1',"<img src='images/ajax.gif' />");
$smarty->assign('rss2',"<img src='images/ajax.gif' />");

$smarty->display('header.tpl');
$smarty->display('allleft.tpl');
/*
$url = "http://feeds.reuters.com/reuters/technologyNews/";
$str = @file_get_contents($url);

@preg_match_all( '|		<title>(.*)</title>|U' , $str , $title);
@preg_match_all( '|		<link>(.*)</link>|U'   , $str , $link);
for($i=0;$i<10;$i++){
   $rss[$i][title]   = $title[1][$i];
   $rss[$i]['link']  = $link[1][$i]; 
}
$smarty->assign("rss",$rss);
*/
$smarty->display('canlist.tpl');

$smarty->display('allright.tpl');
$smarty->display('footer.tpl');
?>
